package com.pedro.streamer.fragment;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;


import com.pedro.streamer.BmiBaseApp;
import com.pedro.streamer.R;
import com.pedro.streamer.adapter.ALiveChoosePicAdapter;
import com.pedro.streamer.adapter.ViewSpecialEffectsListAdapter;
import com.pedro.streamer.utils.RecyclerViewSpacesItemDecoration;

import java.util.HashMap;


public class AliveManagerBlankFragment extends Fragment {

    private RecyclerView choosePicRecyclerView, viewEffectsListRecyclerView;
    private ALiveChoosePicAdapter aLiveChoosePicAdapter;
    private ViewSpecialEffectsListAdapter viewSpecialEffectsListAdapter;
    private Context mContext;

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        mContext = BmiBaseApp.getInstance().getApplicationContext();


        choosePicRecyclerView = view.findViewById(R.id.choose_pic_recycle);
        aLiveChoosePicAdapter = new ALiveChoosePicAdapter();


        HashMap<String, Integer> stringIntegerHashMap = new HashMap<>();
        stringIntegerHashMap.put(RecyclerViewSpacesItemDecoration.LEFT_DECORATION, 10);//左间距
        stringIntegerHashMap.put(RecyclerViewSpacesItemDecoration.RIGHT_DECORATION, 10);//左间距
        stringIntegerHashMap.put(RecyclerViewSpacesItemDecoration.BOTTOM_DECORATION, 10);//左间距

        choosePicRecyclerView.addItemDecoration(new RecyclerViewSpacesItemDecoration(stringIntegerHashMap));

        GridLayoutManager layoutManager = new GridLayoutManager(mContext, 3);
        layoutManager.setOrientation(RecyclerView.VERTICAL);
        choosePicRecyclerView.setLayoutManager(layoutManager);
        choosePicRecyclerView.setAdapter(aLiveChoosePicAdapter);
        aLiveChoosePicAdapter.setClickListener(new ALiveChoosePicAdapter.OnTextClickListener() {
            @Override
            public void onTextClick(int position) {

            }
        });


        viewEffectsListRecyclerView = view.findViewById(R.id.view_special_effects_list_recycler);


        viewSpecialEffectsListAdapter = new ViewSpecialEffectsListAdapter();

        HashMap<String, Integer> listHashMap = new HashMap<>();
        listHashMap.put(RecyclerViewSpacesItemDecoration.BOTTOM_DECORATION, 10);//左间距

        viewEffectsListRecyclerView.addItemDecoration(new RecyclerViewSpacesItemDecoration(listHashMap));


        GridLayoutManager listLayoutManager = new GridLayoutManager(mContext, 1);
        listLayoutManager.setOrientation(RecyclerView.VERTICAL);
        viewEffectsListRecyclerView.setLayoutManager(listLayoutManager);
        viewEffectsListRecyclerView.setAdapter(viewSpecialEffectsListAdapter);


    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_alive_manager_blank, container, false);
    }
}